﻿using DevComponents.DotNetBar;
using Kimd.Motion;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WorkStation.UI
{
    public partial class FormCylinder : OfficeForm
    {
        private Cylinder _cylinder;
        public FormCylinder(Cylinder cylinder)
        {
            InitializeComponent();
            this.EnableGlass = false;
            this._cylinder = cylinder;  
        }
        private void FormCylinder_Load(object sender, EventArgs e)
        {
            if (_cylinder.Origins != null && _cylinder.Origins.Count > 0)
            {
                l_Origin.Text = _cylinder.Origins[0].Description;
            }
            else
            {
                l_Origin.Text = "";
            }
            if (_cylinder.Moves != null && _cylinder.Moves.Count > 0)
            {
                l_Move.Text = _cylinder.Moves[0].Description;
            }
            else
            {
                l_Move.Text = "";
            }
        }
        public void SetCylinder(Cylinder cylinder)
        {
            this._cylinder = cylinder;
            if (_cylinder.Origins != null && _cylinder.Origins.Count > 0)
            {
                l_Origin.Text = _cylinder.Origins[0].Description;
            }
            else
            {
                l_Origin.Text = "";
            }
            if (_cylinder.Moves != null && _cylinder.Moves.Count > 0)
            {
                l_Move.Text = _cylinder.Moves[0].Description;
            }
            else
            {
                l_Move.Text = "";
            }
        }

        private void sB_OnOff_ValueChanged(object sender, EventArgs e)
        {
            if (sB_OnOff.Value)
                _cylinder.On();
            else
                _cylinder.Off();
        }
    }
}
